package com.android.djlmapp.adapter.order;

import android.content.Context;
import android.text.TextUtils;

import com.android.djlmapp.R;
import com.android.djlmapp.model.order.OrderListInfo;
import com.android.djlmapp.tools.global.BigDecimalUtils;

import org.refresh_view.pullrecyclerview.BaseViewHolder;

/**
 * @Author wangziheng
 * @ProjectName djlm
 * @ClassName KkOrderListAdapter
 * @package com.android.djlmapp.adapter.order
 * @data 2018/12/11 19:46
 * @Describe  开卡订单
 * @Change
 */
public class KkOrderListAdapter extends OrderListAdapter {
    public KkOrderListAdapter(Context context) {
        super(context);
    }

    @Override
    protected void convert(BaseViewHolder holder, OrderListInfo.DataBean item) {

        super.convert(holder,item);

        String phonenum = item.getPhone();
        phonenum = separateString(phonenum, 3, 4, ' ');
        mOrderNameTv.setText(phonenum);

        String infoMoney = item.getInto_money();
        if(TextUtils.isEmpty(infoMoney)){
            infoMoney = "0";
        }
        String packageMoney = item.getVirtual_package_money();
        if(TextUtils.isEmpty(packageMoney))
        {
            packageMoney = "0";
        }
        String phoneMoney = item.getVirtual_phonenum_money();
        if(TextUtils.isEmpty(phoneMoney)){
            phoneMoney = "0";
        }
        String price = BigDecimalUtils.add(2,infoMoney,packageMoney,phoneMoney);
        holder.setText(R.id.order_list_orderPrice_tv,"¥:  " + price);
        holder.setImageResource(R.id.order_list_goodsIcon_img,R.mipmap.order_kk_icon);
    }

    @Override
    public String[] getOrderStatusValue(String orderStatusCode,String orderType) {
        String[] orderStatusValue = new String[2];
        switch (orderStatusCode){
            case "1":
                orderStatusValue[0] = "未付款";
                orderStatusValue[1] = COLOR_FF4081;
                break;
            case "2":
                orderStatusValue[0] = "已付款";
                orderStatusValue[1] = COLOR_ff600a;
                break;
            case "3":
                orderStatusValue[0] = "已完成";
                orderStatusValue[1] = COLOR_00ba23;
                break;
            case "4":
                orderStatusValue[0] = "已取消";
                orderStatusValue[1] = COLOR_b9b9b9;
                break;
            default:
                orderStatusValue[0] = "暂无状态";
                orderStatusValue[1] = COLOR_FF4081;
                break;
        }
        return orderStatusValue;
    }
}
